package demo1;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Mikazuki on 2025/3/28.
 */
public class Demo {
    public static void main(String[] args) throws Exception{
        //需求：调用User的sayHello
        User user = new User();
        user.sayHello();
        //使用spring框架来调用User的sayHello方法
        ApplicationContext context = new AnnotationConfigApplicationContext("demo1");
        User user1 = context.getBean(User.class);
        user1.sayHello();

    }
}
